<?php 
header("Content-Type:text/html;charset=utf-8");
session_start();
error_reporting(E_ERROR | E_PARSE);
include 'includes/init.php';
// $export=isset($_POST['export'])?$_POST['export']:'';
$phone=isset($_SESSION['phone'])?$_SESSION['phone']:'';

$infoAll=array();

$sql="select distinct m.id, m.company_name,m.company_address,m.names,m.phone,m.email,m.company_data from t_product as p, t_member as m, t_bid as b  where p.nphone = '".$phone."' and p.type = b.btype and b.mid = m.id ";
// echo $sql;
$infoAll=$db_Obj->getall($sql);

if(!empty($_POST['company_name'])){
	$company_name = $_POST['company_name'];
	$sql = "select * from t_member where company_name like '%".$company_name."%' order by id ";
	$infoAll = $db_Obj->getall($sql);
}

if(!empty($_POST['export'])){
    $export = $_POST['export'];
}

  if ($export == 1) {
      
       
        $columns = array(
            array(
                'title' => '供应商名称',
                'field' => 'company_name',
                'width' => 6
            ),
            array(
                'title' => '供应商代码',
                'field' => 'company_data',
                'width' => 25
            ),
            array(
                'title' => '地址',
                'field' => 'company_address',
                'width' =>20
            ),
            array(
                'title' => '联系人',
                'field' => 'names',
                'width' => 10
            ),
            array(
                'title' => '联系电话',
                'field' => 'phone',
                'width' =>20
            ),
            array(
                'title' => '邮箱',
                'field' => 'email',
                'width' =>20
            )
            
        );
        $exportlist =$infoAll;
       $excObj->export($exportlist, array(
            "title" => "数据-" . date('Y-m-d-H-i', time()),
            "columns" => $columns
        ));
    }
include 'table1.html';
?>


